# This script will demonstrate how to create a user at TuneCore and add an Album and Song.
email = 'alex.kane7@gmail.com'
tunecore_server = "http://test.tunecore.com"
api_key = "testkey"

# Set up our environment
#require 'rubygems'
require 'tunecore_direct'
include TunecoreDirect
TunecoreDirect::Base.tunecore_server = tunecore_server
TunecoreDirect::Base.api_key = api_key



# Create a person
person = TunecoreDirect::Person.new
person.name = "Joe Schmoe"
person.email = email
person.password = "pa$$word"
person.phone_number = "212-555-1212"
person.country = "United States"
person.postal_code = "11201"
# person.create should return true.  If it returns false check person.errors to see why the person
# couldn't be created.  Assuming that it returned true, the person_id attribute will now be set.
puts person.create
puts person.errors

# Create an Album for our person
album = TunecoreDirect::Album.new
album.name = "My Album"
album.person_id = person.person_id # this is the person_id of the person we created above
album.orig_release_date = "2008-02-23"
album.sale_date = "2008-02-23"
album.primary_genre = "Rock"
album.secondary_genre = "Alternative"
album.artist_name = "Alex Kane"
album.label_name = "Shochu"
album.c_copyright = "1999"
album.p_copyright = "1999"
album.recording_location = "Brooklyn"
album.parental_advisory = false
album.stores = "iTunesUS,iTunesAU,iTunesCA,iTunesEU,iTunesJP,iTunesEU,RhapsodyRH,MusicNet,Napster,eMusic,Amazon,Lala"
artwork = TunecoreDirect::Artwork.new
artwork.asset_url = "http://my.host.com/assets/1234.jpg"
album.artwork = artwork
# Our album object is built, now let's create it on the TuneCore server.  Like person, the Album object will 
# return true if the album was created, and false if there was a problem.  If false check album.errors to see
# what the problem was. 
album.create


# Create a song to go on the Album we just created
#song = TunecoreDirect::Song.new
#song.album_id = album.album_id
#song.name = "My song"
#song.track_num = 1
#song.save

# Now that we've created the Song in TuneCore's server the next step is to upload the audio file
# to TuneCore.  We do this by using TuneCore's flash uploade tool.
# The url to upload tool for this song is:


